package cn.org.zych.fileload;

import java.util.HashMap;
import java.util.Map;

public class FileLoadStrategy {

    public static final String FTP_LOAD = "FTPLoad";

    public static final String NAS_LOAD = "NASLoad";

    public static final String CLOUD_DISK_LOAD = "CloudDiskLoad";

    public static final String DEFAULT_LOAD = NAS_LOAD;

    private static Map<String,IFileLoad>  fileLoadStrategy = new HashMap<>();

    static {
        fileLoadStrategy.put(FTP_LOAD,new FTPLoad());
        fileLoadStrategy.put(NAS_LOAD,new NASLoad());
        fileLoadStrategy.put(CLOUD_DISK_LOAD,new CloudDiskLoad());
    }

    public static IFileLoad get(String key){
        if(fileLoadStrategy.containsKey(key)){
            return fileLoadStrategy.get(key);
        }
        return fileLoadStrategy.get(DEFAULT_LOAD);
    }
}
